//
//  ModelHeaderView.m
//  Traveling
//
//  Created by Northwan on 15/6/10.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "ModelHeaderView.h"
#import "OrderEditCtrl.h"
@interface ModelHeaderView()
@property(strong,nonatomic)HomeItemDetailHeaderModel *result;
@end
@implementation ModelHeaderView

+(instancetype)initHeaderView{
    return [[[NSBundle mainBundle]loadNibNamed:@"ModelHeaderView" owner:nil options:nil]lastObject];
}


- (IBAction)reserveTap:(UIButton *)sender {
    OrderEditCtrl *ctrl = nil;
    if(self.result.type == TravelLineDetailType){
        ctrl = [[OrderEditCtrl alloc]initWithData:self.result type:TravelLineOrderEditType];
    }else if(self.result.type == ScenicoDetailType){
        ctrl = [[OrderEditCtrl alloc]initWithData:self.result type:ScenicoOrderEditType];
    }else{
        ctrl = [[OrderEditCtrl alloc]initWithData:self.result type:TravelSpecialtyOrderEditType];
    }
    [self.viewController.navigationController pushViewController:ctrl animated:YES];
     NSLog(@"预订");
}

-(void)initData:(HomeItemDetailHeaderModel *)result{
    self.result = result;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:result.iconUrl]];
    [self.currentPrice setText:[NSString stringWithFormat:@"%.1f",result.currentPrice]];
    [self.prePrice setText:[NSString stringWithFormat:@"%.1f",result.prePrice]];
}
@end
